fix(google): handle content blocking and generation failures#1609
fix(google): handle content blocking and generation failures#1609rosetta-livekit-bot[bot] wants to merge 4 commits into
Conversation
🦋 Changeset detectedLatest commit: 43de72e The changes in this PR will be included in the next version bump. This PR includes changesets to release 33 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
|
||
| for (const part of candidate.content.parts) { | ||
| const chatChunk = this.#parsePart(requestId, part); | ||
| responseGenerated = true; |
There was a problem hiding this comment.
🔴 responseGenerated set to true unconditionally, suppressing "no response" error for empty parts
responseGenerated is set to true on line 450 before checking whether #parsePart returned a non-null chunk. This means if Gemini returns candidate.content.parts containing parts that all parse to null (e.g., parts with neither text nor functionCall, such as executableCode, codeExecutionResult, or empty text parts), responseGenerated becomes true and the post-loop "no response generated" error at line 458 is never thrown.
In contrast, the old code tracked this with chunksYielded which was only set to true inside the if (chatChunk) block, so it correctly detected and retried when parts existed but produced no meaningful output. The new code silently completes the stream with zero content chunks enqueued.
| responseGenerated = true; | |
| if (chatChunk) { | |
| responseGenerated = true; |
Was this helpful? React with 👍 or 👎 to provide feedback.
Ported from python.